package org.kitten.core;

public class DbType {
	public static final String MYSQL = "mysql";

	public static final String SQL_SERVER = "sqlserver";

	public static final String ORACLE = "oracle";

	public static final String DERBY = "derby";
	public static final String HSQLDB = "hsqldb";
	public static final String H2 = "h2";
	public static final int MYSQL_INT = 1;

	public static final int SQL_SERVER_INT = 2;

	public static final int ORACLE_INT = 3;

	public static final int DERBY_INT = 4;
	public static final int HSQLDB_INT = 5;
	public static final int H2_INT = 6;

	public final static String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
	public final static String MYSQL_URL = "jdbc:mysql://127.0.0.1:3306/kangel";

	public final static String JTDS_DRIVER = "net.sourceforge.jtds.jdbc.Driver";
	public final static String JTDS_URL = "jdbc:freetds:sqlserver://127.0.0.1[:<4100>]/<dbname>[;<property>=<value>[;...]]";

	public final static String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
	public final static String ORACLE_URL = "jdbc:oracle:thin:@127.0.0.1:1521:<dbname>";

	public final static String DERBY_DRIVER = "org.apache.derby.jdbc.ClientDriver";
	public final static String DERBY_URL = "jdbc:derby://127.0.0.1:<port>/<dbname>;create=true;";

	public final static String HSQLDB_DRIVER = "org.hsqldb.jdbcDriver";
	public final static String HSQLDB_URL = "jdbc:hsqldb:hsql://127.0.0.1[:<1476>]";

	public final static String H2_DRIVER = "org.h2.Driver";
	public final static String H2_URL = "jdbc:h2:tcp://localhost/~/<dbname>";

	public final static String[] drivers = new String[] { MYSQL_DRIVER,
			JTDS_DRIVER, ORACLE_DRIVER, DERBY_DRIVER, HSQLDB_DRIVER, H2_DRIVER };
	public final static String[] urls = new String[] { MYSQL_URL, JTDS_URL,
			ORACLE_URL, DERBY_URL, HSQLDB_URL, H2_URL };

	public static int str2int(String str) {
		if (MYSQL.equalsIgnoreCase(str)) {
			return MYSQL_INT;
		} else if (SQL_SERVER.equalsIgnoreCase(str)) {
			return SQL_SERVER_INT;
		} else if (ORACLE.equalsIgnoreCase(str)) {
			return ORACLE_INT;
		} else if (DERBY.equalsIgnoreCase(str)) {
			return DERBY_INT;
		} else if (HSQLDB.equalsIgnoreCase(str)) {
			return HSQLDB_INT;
		} else if (H2.equalsIgnoreCase(str)) {
			return H2_INT;
		}
		return 0;
	}
}
